package com.cspg.ssss.util;

public class StringConvertUtil {

    /**
     * byte数组转化为十六进制字符串
     * @param bArr
     * @return
     */
    public static String byteToHex(byte[] bArr) {
        StringBuffer sb = new StringBuffer(bArr.length);
        String sTmp;

        for (int i = 0; i < bArr.length; i++) {
            sTmp = Integer.toHexString(0xFF & bArr[i]);
            if (sTmp.length() < 2)
                sb.append(0);
            sb.append(sTmp.toUpperCase());
        }
        return sb.toString();
    }
}
